#!/bin/sh

# SPDX-FileCopyrightText: Copyright 2022-2024 深圳市同心圆网络有限公司
# SPDX-License-Identifier: GPL-3.0-only

rm -rf client_cfg_api 
protoc -I proto --go_out=. --go-grpc_out=. client_cfg_api.proto

rm -rf user_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. user_api.proto

rm -rf user_resume_api
protoc -I proto --go_out=. --go-grpc_out=. user_resume_api.proto

rm -rf user_notice_api
protoc -I proto --go_out=. --go-grpc_out=. user_notice_api.proto

rm -rf user_memo_api
protoc -I proto --go_out=. --go-grpc_out=. user_memo_api.proto

rm -rf project_api
protoc -I proto --go_out=. --go-grpc_out=. project_api.proto

rm -rf project_member_api
protoc -I proto --go_out=. --go-grpc_out=. project_member_api.proto

rm -rf project_channel_api

rm -rf project_issue_api
protoc -I proto --go_out=. --go-grpc_out=. project_issue_api.proto

rm -rf project_sprit_api
protoc -I proto --go_out=. --go-grpc_out=. project_sprit_api.proto

rm -rf fs_api
protoc -I proto --go_out=. --go-grpc_out=. fs_api.proto

rm -rf external_events_api
protoc -I proto --go_out=. --go-grpc_out=. external_events_api.proto

rm -rf events_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. events_api.proto

rm -rf events_subscribe_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. events_subscribe_api.proto

rm -rf user_kb_api

rm -rf project_doc_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_doc_api.proto

rm -rf project_board_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_board_api.proto

rm -rf project_cicd_api

rm -rf cicd_runner_api

rm -rf project_appraise_api

rm -rf project_entry_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_entry_api.proto

rm -rf project_expert_qa_api
rm -rf project_award_api

rm -rf link_aux_api

rm -rf search_api

rm -rf short_note_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. short_note_api.proto

rm -rf org_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. org_api.proto

rm -rf org_member_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. org_member_api.proto

rm -rf org_okr_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. org_okr_api.proto

rm -rf org_report_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. org_report_api.proto

rm -rf org_forum_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. org_forum_api.proto

rm -rf org_asset_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. org_asset_api.proto

rm -rf org_evaluate_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. org_evaluate_api.proto

rm -rf admin_auth_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. admin_auth_api.proto

rm -rf project_requirement_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_requirement_api.proto


rm -rf appstore_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. appstore_api.proto

rm -rf bookstore_api
rm -rf user_app_api

rm -rf project_code_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_code_api.proto

rm -rf project_chat_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_chat_api.proto

rm -rf project_idea_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_idea_api.proto

rm -rf project_alarm_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_alarm_api.proto

rm -rf project_watch_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_watch_api.proto

rm -rf project_comment_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_comment_api.proto

rm -rf project_testcase_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_testcase_api.proto

rm -rf project_recycle_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_recycle_api.proto

rm -rf project_git_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_git_api.proto

rm -rf project_server_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_server_api.proto

rm -rf user_book_shelf_api

rm -rf project_bulletin_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. project_bulletin_api.proto

rm -rf data_anno_project_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. data_anno_project_api.proto

rm -rf data_anno_task_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. data_anno_task_api.proto

rm -rf docker_template_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. docker_template_api.proto

rm -rf api_collection_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. api_collection_api.proto

rm -rf http_custom_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. http_custom_api.proto

rm -rf rss_api
rm -rf user_rss_api
rm -rf pub_search_api

rm  -rf group_api
rm  -rf group_member_api
rm  -rf group_post_api

rm  -rf dev_container_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. dev_container_api.proto

rm  -rf idea_store_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. idea_store_api.proto

rm  -rf widget_store_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. widget_store_api.proto

rm  -rf sw_store_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. sw_store_api.proto

rm -rf skill_center_api
rm -rf skill_resource_api
rm -rf skill_test_api
rm -rf skill_learn_api

rm -rf keyword_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. keyword_api.proto

rm -rf git_vp_api

rm -rf feedback_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. feedback_api.proto

rm -rf events
protoc -I proto/events --go_out=. events_project.proto
protoc -I proto/events --go_out=. events_issue.proto
protoc -I proto/events --go_out=. events_external_event.proto
protoc -I proto/events --go_out=. events_gitee.proto
protoc -I proto/events --go_out=. events_gogs.proto
protoc -I proto/events --go_out=. events_gitlab.proto
protoc -I proto/events --go_out=. events_atomgit.proto
protoc -I proto/events --go_out=. events_requirement.proto
protoc -I proto/events --go_out=. events_code.proto
protoc -I proto/events --go_out=. events_idea.proto
protoc -I proto/events --go_out=. events_entry.proto
protoc -I proto/events --go_out=. events_harbor.proto
protoc -I proto/events --go_out=. events_testcase.proto
protoc -I proto/events --go_out=. events_data_anno.proto

rm -rf notices
protoc -I proto/notices --go_out=.  notices_issue.proto
protoc -I proto/notices --go_out=.  notices_project.proto
protoc -I proto/notices --go_out=.  notices_idea.proto
protoc -I proto/notices --go_out=.  notices_comment.proto
protoc -I proto/notices --go_out=.  notices_board.proto
protoc -I proto/notices --go_out=.  notices_chat.proto
protoc -I proto/notices --go_out=.  notices_entry.proto
protoc -I proto/notices --go_out=.  notices_testcase.proto
protoc -I proto/notices --go_out=.  notices_requirement.proto
protoc -I proto/notices --go_out=.  notices_org.proto
protoc -I proto/notices --go_out=.  notices_user.proto

rm -rf k8s_proxy_api

rm -rf swarm_proxy_api

rm -rf trace_proxy_api

rm -rf net_proxy_api

rm -rf gitcd_runner_api
protoc -I proto -I proto/third_part --go_out=. --go-grpc_out=. gitops/gitcd_runner_api.proto

# 去除生成代码的linsece头
find . -type f|grep -v ".git"|egrep -e "\.go$"|awk '{print "sed -i '1,3d' "$1}'|bash